package com.ctgu.springboot.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ctgu.springboot.entity.ComInfo;
import com.ctgu.springboot.service.ComInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author cs
 * @since 2023-07-07
 */
@RestController
@RequestMapping("/com-info")
public class ComInfoController {
    @Autowired
    private ComInfoService comInfoService;
    //公司信息列表
    @RequestMapping("list")
    public List<ComInfo> list(){
        return comInfoService.list();
    }
    //根据企业id查找企业信息
    @RequestMapping("findcomid")
    public List<ComInfo> findcomid(int com_id){
        QueryWrapper<ComInfo> comInfoQueryWrapper=new QueryWrapper<>();
        comInfoQueryWrapper.eq("com_id",com_id);
        return comInfoService.list(comInfoQueryWrapper);
    }

    //创建新公司(测不出来!寄)
    @RequestMapping("save")
    public String save(ComInfo comInfo){
        comInfoService.save(comInfo);
        return "success";
    }
}
